package cn.wanho.dao;

import cn.wanho.dto.CmsUser;
import cn.wanho.rvo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * @Author: FXP
 * @Date: 2022/08/04/9:48
 * @Description: 
 */
@Mapper
public interface CmsUserMapper {
    /**
     * 根据用户名查用户
     * @param userName
     * @return
     */
    CmsUser selectByUserName(String userName);

    /**
     * 修改密码
     * @param id
     * @param newPassword
     * @return
     */
    int updatePassword(@Param("id") Integer id,@Param("newPassword") String newPassword);

    /**
     * 根据id查用户
     * @param id primary key
     * @return object by primary key
     */
    CmsUser selectById(Integer id);







    /**
     * delete by primary key
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * insert record to table
     * @param record the record
     * @return insert count
     */
    int insert(CmsUser record);

    /**
     * insert record to table selective
     * @param record the record
     * @return insert count
     */
    int insertSelective(CmsUser record);



    /**
     * update record selective
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(CmsUser record);

    /**
     * update record
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(CmsUser record);

    /**
     * 根据id查找学生信息
     * @param studentId
     * @return
     */
    List<selectStudentBystuIdVO> selectStudentBystuId(Integer studentId);



    /**
     * 根据班级id查询该班级的学生
     * @param classId
     * @return
     */
    List<SelectStudentsByClassIdVO> selectStudentsByClassId(Integer classId);


    /**
     *  查看该老师当前所带的班级
     * @param teacherId
     * @return
     */
    List<SelectTeacherInClassStudentsVO> selectDefaultStudents(Integer teacherId);

    /**
     * 修改老师个人信息（含头像）
     * @return
     */
    int modifySelf(String  path, String introduction,Integer teacherId);

    /**
     * 查找所有老师
     * @return
     */
    List<TeacherVO> selectAllTeacher();

    /**
     * 移除老师
     * @param userId
     * @return
     */
    int removeTeacher(Integer userId);

    /**
     * 修改学生个人信息
     * @param path
     * @param introduction
     * @param studentId
     * @return
     */
    int modifyStudentSelf(String  path, String introduction,Integer studentId);

    /**
     * 查询学生个人信息
     * @return
     */
    StudentVO selectMyself(Integer studentId);

    /**
     * 查询学生当前阶段和老师
     * @param studentId
     * @return
     */
    selectTeacherStageVO showinfo(Integer studentId);

    /**
     * 根据用户名进行查询信息
     * @param username
     * @return
     */
    CmsUser selectByUsername(String username);

    /**
     * 查看学生 没班级
     * @return
     */
    List<SimpleStudentVO> selectAllStudent();

    /**
     * 获得所有老师
     * @return
     */
    List<SimpleTeacherVO> selectAllTeacher2();
}